import{CanceledError as n}from"axios";class i{config;onCanceled;constructor(n){this.config=n}subscribe(i,e){(this.config.cancelToken||this.config.signal)&&(this.onCanceled=s=>{i&&(e(!s||s.type?new n(void 0,void 0,this.config,i):s),i.abort(),i=null)},this.config.cancelToken&&this.config.cancelToken.subscribe(this.onCanceled),this.config.signal&&this.config.signal.addEventListener&&(this.config.signal.aborted?this.onCanceled():this.config.signal.addEventListener("abort",this.onCanceled)))}unsubscribe(){this.config.cancelToken&&this.config.cancelToken.unsubscribe(this.onCanceled),this.config.signal&&this.config.signal.removeEventListener&&this.config.signal.removeEventListener("abort",this.onCanceled)}}export{i as default};
//# sourceMappingURL=onCanceled.mjs.map
